package com.example.activities;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;

public class ApresentacaoActivity extends Activity {

	private TextView viewNome;
	private EditText resposta;
	public final static String EXTRA_RESPOSTA = "com.example.activities.RESPOSTA";
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_apresentacao);
		
		viewNome = (TextView) findViewById(R.id.mostraNome);
		//String nome = getIntent().getStringExtra(MainActivity.EXTRA_NOME);
		
		Bundle bundle = getIntent().getExtras();
		viewNome.setText(bundle.getString(MainActivity.EXTRA_NOME));
		
		resposta = (EditText) findViewById(R.id.editResposta);
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.apresentacao, menu);
		return true;
	}
	
	public void sendResposta(View v){

		Intent i = new Intent();
		i.putExtra(EXTRA_RESPOSTA, resposta.getText().toString());
		
		setResult(RESULT_OK, i);
		finish();
		
		
	}

}
